home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;AGA White Fade
- ;--------------
- ;Fades the screen to white, then down to a palette, and exits with a fade
- ;to black.
- ;
- ;This demo can load and fade any picture that you specify at the end of
- ;this file.
- ;
- ;Press left mouse button to exit.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "AGAWhiteFade",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- lea PictureTags(pc),a1
- CALL LoadPic
- tst.l d0
- beq.s .Error_Picture
-
- CALL GetScreen
- move.l d0,Screen
- beq.s .Error_Screen
- move.l d0,a0
- move.l Picture(pc),a1
- move.l PIC_AmtColours(a1),GS_AmtColours(a0)
- move.w PIC_Planes(a1),GS_Planes(a0)
- move.w PIC_ScrType(a1),GS_ScrType(a0)
- move.l PIC_Data(a1),GS_MemPtr1(a0)
- move.w #320,GS_ScrWidth(a0)
- move.w #256,GS_ScrHeight(a0)
- move.w PIC_Width(a1),GS_PicWidth(a0)
- move.w PIC_Height(a1),GS_PicHeight(a0)
- move.w PIC_ScrMode(a1),GS_ScrMode(a0)
- CALL AddScreen
- tst.l d0
- beq.s .Error_Screen
-
- CALL ShowScreen
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Picture(pc),a1
- CALL FreePic
- .Error_Picture
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN CODE
- ;===========================================================================;
-
- Main: move.l Screen(pc),a0
- moveq #$00,d0 ;d0 = FadeState (reset).
- moveq #5,d1 ;d1 = Speed of fade.
- moveq #$000000,d2 ;d2 = Source colour
- move.l #$ffffff,d5 ;d5 = Destination colour.
- moveq #00,d3 ;d3 = Start colour
- move.l GS_AmtColours(a0),d4 ;d4 = Amount of colours.
- .f_in CALL WaitVBL
- CALL ColourMorph ;Do the fade routine.
- tst.w d0 ;Has the fade finished yet?
- bne.s .f_in ;If not, keep doing it.
-
- moveq #2,d1 ;d1 = Speed of fade.
- move.l Picture(pc),a1
- move.l PIC_Palette(a1),a1 ;a1 = Palette to fade to.
- move.l #$ffffff,d2 ;d2 = Colour we are fading from.
- .f_mid CALL WaitVBL
- CALL ColourToPalette ;Do the fade routine.
- tst.w d0 ;Has the fade finished yet?
- bne.s .f_mid ;If not, keep doing it.
-
- moveq #2,d1 ;d0 = Speed of fade.
- move.l Picture(pc),a1
- move.l PIC_Palette(a1),a1 ;a1 = Palette to fade to.
- moveq #$000000,d2 ;d2 = Destination colour.
- .f_out CALL WaitVBL
- CALL PaletteToColour ;Do the fade routine.
- tst.w d0 ;Has the fade finished yet?
- bne.s .f_out ;If not, keep doing it.
-
- moveq #20,d0
- CALL WaitTime
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- Screen: dc.l 0
-
- PictureTags:
- dc.l TAGS_PICTURE
- Picture dc.l 0
- dc.l PCA_Options,GETPALETTE|VIDEOMEM
- dc.l PCA_File,.file
- dc.l TAGEND
- .file dc.b "GMS:demos/data/PIC.Loading",0
- even
-
-